package com.xyy.saas.payment.util;

/**
 * @author wangtianqi
 * @date 2019/12/17 15:17
 */
public class ChannelFeeUtil {

    /**
     * 微信渠道手续费
     */
    private static double WX_CHANNEL_FEE = 0.01;

    /**
     * 获取微信支付时产生的手续费
     * 传入的收款金额 amount > 0
     * @param amount
     * @return
     */
    public static int getWXPayFee(int amount) {
        return 0 - (int)Math.ceil(amount * WX_CHANNEL_FEE);
    }

    /**
     * 获取微信退款时退的手续费
     * 传入的退款金额 amount < 0
     * @param amount
     * @return
     */
    public static int getWXRefundFee(int amount) {
        return(int)Math.floor((0 - amount) * WX_CHANNEL_FEE);
    }

}
